/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2018-11-06     SummerGift   first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

#define THREAD_PRIORITY         25
#define THREAD_STACK_SIZE       512
#define THREAD_TIMESLICE        5


extern void main_thread(void *parameter);
static rt_thread_t tid1 = RT_NULL;

/* defined the LED0 pin: PB1 */
#define LED0_PIN    GET_PIN(B, 5)

#define LED2_PIN    GET_PIN(F, 10)

int main(void)
{
    int count = 1;
    /* set LED0 pin mode to output */
    rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
	
	/* Create main thread */
    tid1 = rt_thread_create("main_thread",
                            main_thread, RT_NULL,                            
                            THREAD_STACK_SIZE,
                            THREAD_PRIORITY, THREAD_TIMESLICE);

	if (tid1 != RT_NULL)
		rt_thread_startup(tid1);

    while (count++)
    {
        rt_pin_write(LED0_PIN, PIN_HIGH);
		//rt_pin_write(90, PIN_HIGH);
        rt_thread_mdelay(500);
        rt_pin_write(LED0_PIN, PIN_LOW);
				//rt_pin_write(90, PIN_LOW);
        rt_thread_mdelay(500);
    }

    return RT_EOK;
}
